import request from '@/utils/request'

export function get_booklist(params) {
    return request({
      url:'/fl-book/getCategoriesBooks',
      method:'get',
      params:params
    })
  }

 //获取分类列表
    export function get_classifylist() {
      return request({
        url: '/fl-categories/getAllClassify',
        method: 'get',
       
      })
    }

//添加分类
export function add_classify(data) {
  return request({
    url: '/fl-categories/addCategories',
    method: 'post',
    data
  })
}

//删除分类
export function del_classify(data) {
  return request({
    url: '/fl-categories/deleteCategories?categoriesName='+data,
    method: 'delete',
    header: {
      'content-type': 'application/x-www-form-urlencoded' // 默认值
  },
   
  })
}

//修改分类
export function edit_classify(data) {
  return request({
    url: '/fl-categories/updateCategories',
    method: 'post',
    header: {
      'content-type': 'application/x-www-form-urlencoded' // 默认值
  },
    data,
   
  })
}

//通过ISBN查询图书
export function get_book_by_isbn(params) {
  return request({
    url: '/fl-admin/getISBNDetail',
    method: 'get',
    params
  })
}

//添加图书
export function add_book(data) {
  return request({
    url: '/fl-book/bulkInsertBooksByISBNs',
    method: 'post',
    data
  })
}

//通过isbn查数据库图书
export function get_book_by_isbn_db(params) {
  return request({
    url: '/fl-searchBook/searchBooksByElastSearch',
    method: 'get',
    params
  })
}

//通过书名查找图书
export function get_book_by_name(params) {
  return request({
    url: '/fl-book/getBooksByName',
    method: 'get',
    params
  })
}

//筛选搜索图书
export function get_book_by_filter(data) {
  return request({
    url: '/fl-admin/advancedSearch',
    method: 'post',
    data
  })
}

//批量下架图书
export function put_book(data) {
  return request({
    url: '/fl-admin/putOrPullBooks',
    method: 'post',
    data
  })
}

//更改图书库存
export function change_book_stock(data) {
  return request({
    url: '/fl-admin/changeStock',
    method: 'post',
    data
  })
}

//获取点击排名前十的图书
export function get_book_click_top(data) {
  return request({
    url: '/fl-admin/getBookHitsTop',
    method: 'post',
    data
  })
}

//通过图书Id获取图书详情
export function get_book_detail(params) {
  return request({
    url: '/fl-book/searchBookByBookId',
    method: 'get',
    params
  })
}